package pwr.inf.imt.tests;

import static org.junit.Assert.*;

import java.util.ArrayList;
import java.util.List;

import org.junit.Test;

import pwr.inf.imt.DataLead;

public class DataLeadTests {
	
	@Test
	public void testGetPartsCount() {
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 1; i < 4; i++) {
			list.add(new Integer(i));			
		}
		String name = new String("I");
		DataLead cut = new DataLead(name, list);
		int expected_length = 3;
		assertEquals("Expected Length", expected_length, cut.getPartsCount());
	}

	@Test
	public void testGetParts() {
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 1; i < 4; i++) {
			list.add(new Integer(i));			
		}
		String name = new String("I");
		DataLead cut = new DataLead(name, list);
		assertNotNull(cut);
		int tab[] = {1, 2, 3};
		
		Integer[] a = new Integer[3];
		Integer[] array = cut.getParts().toArray(a);
		int[] tab2 = new int[array.length];
		for (int i = 0; i < array.length; i++) {
			tab2[i] = array[i].intValue();
		}
		assertArrayEquals(tab, tab2);
	}

	@Test
	public void testDataLead() {
		List<Integer> list = new ArrayList<Integer>();
		for (int i = 0; i < 100; i++) {
			list.add(new Integer(i));			
		}
		String name = new String("I");
		assertNotNull(new DataLead(name, list));
	}

}
